home *** CD-ROM | disk | FTP | other *** search
- //==============================================================================================
- //
- // Windows Interface Construction Set
- // Version 1.00
- //
- // EFRAME.CPP - Extended Frame Class
- // Copyright ⌐ 1993 by Microdyne Development Technologies.
- // All rights reserved.
- //==============================================================================================
-
- #include "eframe.h"
-
- //----------------------------------------------------------------------------------------------
- // Constructor for TExtendedMDIFrame
- //
- // The TExtendedMDIFrame is the main frame window of the application. This window
- // contains all user work areas as child windows. The routine creates an icon bar
- // control.
- //----------------------------------------------------------------------------------------------
-
- TExtendedMDIFrame::TExtendedMDIFrame(LPSTR ATitle, LPSTR MenuName, BOOL fIconbar, BOOL fStatusbar, PTModule AModule)
- : TMDIFrame(ATitle, MenuName, AModule)
- {
- AnIconBar = ( fIconbar ) ? new TIconBar (this) : NULL ;
- AStatusBar = ( fStatusbar ) ? new TStatusBar (this) : NULL ;
- APrinter = new TPrinter();
-
- idHelpMessage = RegisterWindowMessage (HELPMSGSTRING);
- idFindTextMessage = RegisterWindowMessage (FINDMSGSTRING);
-
- hBackgroundBrush = CreateSolidBrush (GetSysColor(COLOR_APPWORKSPACE));
- }
-
- TExtendedMDIFrame::TExtendedMDIFrame(LPSTR ATitle, int MenuId, BOOL fIconbar, BOOL fStatusbar, PTModule AModule)
- : TMDIFrame(ATitle, MenuId, AModule)
- {
- AnIconBar = ( fIconbar ) ? new TIconBar (this) : NULL ;
- AStatusBar = ( fStatusbar ) ? new TStatusBar (this) : NULL ;
- APrinter = new TPrinter();
-
- idHelpMessage = RegisterWindowMessage (HELPMSGSTRING);
- idFindTextMessage = RegisterWindowMessage (FINDMSGSTRING);
-
- hBackgroundBrush = CreateSolidBrush (GetSysColor(COLOR_APPWORKSPACE));
- }
-
-
- //----------------------------------------------------------------------------------------------
- // Destructor for TExtendedMDIFrame
- //
- // The destructor is called when the application terminates. The routine disposes of the
- // icon bar.
- //----------------------------------------------------------------------------------------------
-
- TExtendedMDIFrame::~TExtendedMDIFrame()
- {
- DeleteObject (hBackgroundBrush);
- delete APrinter;
- }
-
- //----------------------------------------------------------------------------------------------
- // WMSize
- //
- // The window processes this message whenever the window changes size. This routine calls the
- // default process (TMDIFrame::WMSize) and then resizes the Iconbar (AnIconBar) and Client area
- // according to the new window size.
- //----------------------------------------------------------------------------------------------
-
- void TExtendedMDIFrame::WMSize(RTMessage Msg)
- {
- TMDIFrame::WMSize(Msg);
-
- if ( AnIconBar )
- {
- if ( AStatusBar )
- {
- SetWindowPos (AnIconBar->HWindow, NULL, -1, -1, LOWORD(Msg.LParam)+2, AnIconBar->GetHeight(), SWP_NOZORDER);
- SetWindowPos (ClientWnd->HWindow, NULL, 0, AnIconBar->GetHeight()-1, LOWORD(Msg.LParam), HIWORD(Msg.LParam)-AnIconBar->GetHeight()-AStatusBar->GetHeight()+2, SWP_NOZORDER);
- SetWindowPos (AStatusBar->HWindow, NULL, -1, HIWORD(Msg.LParam)-AStatusBar->GetHeight()+1, LOWORD(Msg.LParam)+2, AStatusBar->GetHeight(), SWP_NOZORDER);
- }
- else
- {
- SetWindowPos (AnIconBar->HWindow, NULL, -1, -1, LOWORD(Msg.LParam)+2, AnIconBar->GetHeight(), SWP_NOZORDER);
- SetWindowPos (ClientWnd->HWindow, NULL, 0, AnIconBar->GetHeight()-1, LOWORD(Msg.LParam), HIWORD(Msg.LParam)-AnIconBar->GetHeight()+1, SWP_NOZORDER);
- }
- }
- else
- {
- if ( AStatusBar )
- {
- SetWindowPos (ClientWnd->HWindow, NULL, 0, 0, LOWORD(Msg.LParam), HIWORD(Msg.LParam)-AStatusBar->GetHeight()+1, SWP_NOZORDER);
- SetWindowPos (AStatusBar->HWindow, NULL, -1, HIWORD(Msg.LParam)-AStatusBar->GetHeight()+1, LOWORD(Msg.LParam)+2, AStatusBar->GetHeight(), SWP_NOZORDER);
- }
- }
- }
-
- void TExtendedMDIFrame::GetWindowClass(WNDCLASS _FAR & AWndClass)
- {
- TMDIFrame::GetWindowClass(AWndClass);
-
- AWndClass.hbrBackground = hBackgroundBrush;
- }
-
- void TExtendedMDIFrame::CMPrinterSetup (RTMessage)
- {
- APrinter->Configure(this);
- }
-
- void TExtendedMDIFrame::DefWndProc (RTMessage Msg)
- {
- if ( Msg.Message == idHelpMessage )
- WMCommDlgHelp (Msg);
- else
- TMDIFrame::DefWndProc(Msg);
- }
-
- void TExtendedMDIFrame::WMCommDlgHelp (RTMessage msg)
- {
- switch ( msg.WParam )
- {
- case WCDID_OPENFILENAME:
- OpenFileHelp();
- break;
-
- case WCDID_SAVEFILENAME:
- SaveFileHelp();
- break;
-
- case WCDID_CHOOSECOLOR:
- ChooseColorHelp();
- break;
-
- case WCDID_CHOOSEFONT:
- ChooseFontHelp();
- break;
-
- case WCDID_FINDTEXT:
- FindTextHelp();
- break;
-
- case WCDID_REPLACETEXT:
- ReplaceTextHelp();
- break;
-
- case WCDID_PRINTDLG:
- PrintHelp();
- break;
-
- case WCDID_PRINTSETUP:
- PrintSetupHelp();
- break;
- }
- }
-
- void TExtendedMDIFrame::CheckMenu(UINT id)
- {
- HWND hMenu;
-
- if ((hMenu = GetMenu(HWindow)) != NULL )
- CheckMenuItem (hMenu, id, MF_BYCOMMAND | MF_CHECKED);
- }
-
- void TExtendedMDIFrame::UncheckMenu (UINT id)
- {
- HWND hMenu;
-
- if ((hMenu = GetMenu(HWindow)) != NULL )
- CheckMenuItem (hMenu, id, MF_BYCOMMAND | MF_UNCHECKED);
- }
-
- void TExtendedMDIFrame::FlipMenuCheck (UINT id)
- {
- HWND hMenu;
-
- if ((hMenu = GetMenu(HWindow)) != NULL )
- if ( GetMenuState (hMenu, id, MF_BYCOMMAND) & MF_CHECKED )
- CheckMenuItem (hMenu, id, MF_BYCOMMAND | MF_UNCHECKED);
- else
- CheckMenuItem (hMenu, id, MF_BYCOMMAND | MF_CHECKED);
- }
-
- void TExtendedMDIFrame::DisableMenuEntry (UINT id)
- {
- HWND hMenu;
-
- if ((hMenu = GetMenu(HWindow)) != NULL )
- EnableMenuItem (hMenu, id, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
- }
-
- void TExtendedMDIFrame::EnableMenuEntry (UINT id)
- {
- HWND hMenu;
-
- if ((hMenu = GetMenu(HWindow)) != NULL )
- EnableMenuItem (hMenu, id, MF_BYCOMMAND | MF_ENABLED);
- }
-
- void TExtendedMDIFrame::PlaceIconBarButton (WORD x, WORD y, WORD Id, BOOL fState)
- {
- if (AnIconBar )
- AnIconBar->PlaceButton(x,y,Id,fState);
- }
-
- void TExtendedMDIFrame::PlaceIconBarButton (WORD Id, BOOL fState)
- {
- if ( AnIconBar )
- AnIconBar->PlaceButton(Id,fState);
- }
-
- void TExtendedMDIFrame::PlaceFontSelectionControl (WORD x, WORD y, WORD Id)
- {
- if ( AnIconBar )
- AnIconBar->PlaceFontSelectionControl(x,y,Id);
- }
-
- void TExtendedMDIFrame::PlaceFontSelectionControl (WORD Id)
- {
- if ( AnIconBar )
- AnIconBar->PlaceFontSelectionControl(Id);
- }
-
- void TExtendedMDIFrame::InsertIconBarSpace()
- {
- if ( AnIconBar )
- AnIconBar->InsertSpace();
- }
-
- BOOL TExtendedMDIFrame::IsIconBarButtonChecked (WORD Id)
- {
- if ( AnIconBar )
- return AnIconBar->IsButtonChecked(Id);
-
- return FALSE;
- }
-
- void TExtendedMDIFrame::GetSelectedFontFamilyName (WORD cchMax, LPSTR lpFamilyName)
- {
- if ( AnIconBar )
- AnIconBar->GetSelectedFontFamilyName(cchMax, lpFamilyName);
- else
- lstrcpy ( lpFamilyName, "" );
- }
-
- int TExtendedMDIFrame::GetSelectedFontSize ()
- {
- if ( AnIconBar )
- return AnIconBar->GetSelectedFontSize ();
-
- return 0;
- }
-
- void TExtendedMDIFrame::RemoveIconBarControl (WORD Id)
- {
- if ( AnIconBar )
- AnIconBar->RemoveControl (Id);
- }
-
- void TExtendedMDIFrame::SetIconBarButtonCommandCode (WORD Id, WORD cmd)
- {
- if ( AnIconBar )
- AnIconBar->SetButtonCommandCode (Id, cmd);
- }
-
- void TExtendedMDIFrame::SetIconBarButtonState (WORD Id, BOOL fState)
- {
- if ( AnIconBar )
- AnIconBar->SetButtonState (Id, fState);
- }
-
- void TExtendedMDIFrame::SetFontFamilyName (LPSTR lpFamilyName)
- {
- if ( AnIconBar )
- AnIconBar->SetFontFamilyName (lpFamilyName);
- }
-
- void TExtendedMDIFrame::SetFontFamilyCommandCode (WORD code)
- {
- if ( AnIconBar )
- AnIconBar->SetFontFamilyCommandCode (code);
- }
-
- void TExtendedMDIFrame::SetFontSize (int s)
- {
- if ( AnIconBar )
- AnIconBar->SetFontSize (s);
- }
-
- void TExtendedMDIFrame::SetFontSizeCommandCode (WORD code)
- {
- if ( AnIconBar )
- AnIconBar->SetFontSizeCommandCode (code);
- }
-
- void TExtendedMDIFrame::SetFontStyle(LOGFONT FAR *lplf)
- {
- if ( AnIconBar )
- AnIconBar->SetFontStyle(lplf);
- }
-
- void TExtendedMDIFrame::SetIconBarStartPoint (WORD x)
- {
- if ( AnIconBar )
- AnIconBar->SetStartPoint (x);
- }
-
-